package com.jdd.modules.area.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jdd.modules.area.entity.ChargeRulesModuleStep;
import com.jdd.modules.area.mapper.ChargeRulesModuleStepMapper;
import com.jdd.modules.area.service.IChargeRulesModuleStepService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description: 停车场计费规则模块表
 * @Author: jdd
 * @Date:   2021-07-13
 * @Version: V1.0
 */
@Service
public class ChargeRulesModuleStepServiceImpl extends ServiceImpl<ChargeRulesModuleStepMapper, ChargeRulesModuleStep> implements IChargeRulesModuleStepService {
    @Resource
    private ChargeRulesModuleStepMapper chargeRulesModuleStepMapper;

    @Override
    public List<ChargeRulesModuleStep> getChargeRulesModuleSteps(String chargeRulesModuleId) {
        return chargeRulesModuleStepMapper.getChargeRulesModuleSteps(chargeRulesModuleId);
    }
    @Override
    public Integer getNowTimeStep(String chargeRulesModuleId,Integer parkTime){
        return chargeRulesModuleStepMapper.getNowTimeStepFee(chargeRulesModuleId,parkTime);
    }
    @Override
    public Integer getMaxTimeStep(String chargeRulesModuleId){
        Integer fee = chargeRulesModuleStepMapper.getMaxTimeStepFee(chargeRulesModuleId);
        if(null==fee)
        {
            return 0;
        }else {
            return fee;
        }
    }
    @Override
    public Integer deleteByChargeRulesModuleId(String chargeRulesModuleId)
    {
        return chargeRulesModuleStepMapper.deleteByChargeRulesModuleId(chargeRulesModuleId);
    }

    @Override
    public Integer deleteByChargeRulesModuleIdAndParkTime(String chargeRulesModuleId, Integer parkTime) {
        return chargeRulesModuleStepMapper.deleteByChargeRulesModuleIdAndParkTime(chargeRulesModuleId,parkTime);
    }

}
